<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/jQuery.min.js"></script>
    <script>
        $(function(){
            /* var targetObj = {};
            var obj = {
                id:1,
                name:'andy'
            }
            $.extend(targetObj,obj)
            console.log(targetObj); */
            var targetObj = {
                id:0,
                msg:{
                    sex:'男'
                }
            };
            var obj = {
                id:1,
                name:'andy',
                msg:{
                    age:18
                }
            }
            $.extend(true,targetObj,obj)//会覆盖原来的数据
            console.log(targetObj);
            targetObj.msg.age = 20;
            console.log(obj);
        })
    </script>
</head>
<body>
    
</body>
</html>